<?php declare(strict_types=1);


namespace App\Task\Task;

use App\Model\Entity\LoginLog;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Task\Annotation\Mapping\Task;
use Swoft\Task\Annotation\Mapping\TaskMapping;

/**
 * Class BaseTask
 *
 * @since 2.0
 *
 * @Bean()
 * @Task(name="baseTask")
 */
class BaseTask
{

    /**
     * //用户登录日志记录
     * @TaskMapping(name="loginLog")
     *
     */
    public function loginLog($member_id, $device, $serial_number, $ip, $version)
    {
        $equipment = config('app.device_conf');
        $login_log = LoginLog::new();
        $login_log->setMemberId($member_id);
        $login_log->setEquipment($equipment[$device]);
        $login_log->setEquipmentNumber($serial_number);
        $login_log->setCoordinate('');
        $login_log->setLoginIp($ip);
        $login_log->setVersion($version);
        $login_log->setLoginTime(time());
        $login_log->save();
    }


}